import {fetch} from './fetch';


/***
 * 公共
 * */
//获取区域
export function areaApi(data) {
  return fetch({
    url:'api/city/read',
    method:'get',
    params:{
      code:data
    }
  })
}
//登录
export function Login(data) {
  return fetch({
    url: 'login',
    method: 'post',
    data: data,
  })
}
//获取城市列表
export function CityList(data) {
  return fetch({
    url:'api/city',
    method:'get',
    params:data
  })
}
// 获取父栏目下下所有子栏目
export function ChildrenList(data) {
  return fetch({
    url:'api/article/channel',
    method:'get',
    params:data
  })
}

//获取资讯列表
export function InformationList(data) {
  return fetch({
    url:'api/article',
    method:'get',
    params:data
  })
}

//获取资讯详情和相关资讯
export function getListDetails(data) {
  return fetch({
    url:'api/article/' + data,
    method:'get',
  })
}

//获取视频栏目分类
export function getChildVideo(data) {
  return fetch({
    url:'api/video/channel',
    method:'get',
    params:data
  })
}
//获取视频列表
export  function getListVideo(data) {
  return fetch({
    url:'api/video',
    method:'get',
    params:{
      name:data.active,
      page:data.page,
    }
  })
}
//获取视频内容
export function getVideoContent(data) {
  return fetch({
    url:'api/video/' + data,
    method:'get'
  })
}
//获取商务海报
export function getBusinessPoster(data) {
  return fetch({
    url:'api/commerce',
    method:'get',
    params:data
  })
}
//获取楼盘下拉请求数据
export function buildSelectData(data) {
  return fetch({
    url:'api/premises/select',
    method:'get',
    params:{
      city_code:data,
    }
  })
}
//获取楼盘列表数据
export function buildList(data) {
  return fetch({
    url:'api/premises',
    method:'get',
    params:data
  })
}
//获取楼盘详情
export function buildData(data) {
  return fetch({
    url:'api/premises/' + data,
    method:'get',
  })
}
//获取楼盘更多动态
export function moreBuildNews(data) {
  return fetch({
    url:'api/premises/dynamic/' + data,
    method:'get',
  })
}
//获取楼盘更多详情
export function moreBuildData(data) {
  return fetch({
    url:'api/premises/total/' + data,
    method:'get'
  })
}
//获取楼盘照片
export function buildPhoto(data) {
  return fetch({
    url:'api/premises/photo',
    method:'get',
    params:{
      premises_id:data
    }
  })
}

// 获取房源下拉选择数据

export function houseSelectData(data) {
  return fetch({
    url:'api/house/select',
    method:'get',
    params:{
      city_code:data,
    }
  })
}

//获取房源列表
export function houseList(data) {
  return fetch({
    url:'api/house',
    method:'get',
    params:data
  })
}
//获取房源详情
export function houseData(data) {
  return fetch({
    url:'api/house/' + data,
    method:'get',
  })
}


/**
 * 委托房源 API
 *
 */
//单选框数据
export function houseRadio(data) {
  return fetch({
    url:'api/house/entrustSelect',
    method:'get',
    params:{
      city_code:data
    }
  })
}
//委托出售
export function entrustSubmit(data) {
 return fetch({
   url:'api/house/entrust',
   method:'post',
   data:data
 })
}

/**
 * 首页 API
 *
  */
//首页资讯
 export function indexInformation(data) {
  return fetch({
    url:'api/article/information',
    method:'get',
    params:{
      city_id:data
    }
  })
}
//热门视频
export function hotVideo(data) {
  return fetch({
    url:'api/hotvideo',
    method:'get',
    params:{
      diyname:data.diyname
    }
  })
}
//首页轮播图
export function swipeList(data) {
  return fetch({
    url:'api/banner',
    method:'get',
    params:{
      city_code:data
    },
  })
}
//首页底部用户申请客服回访接
export function customerData(data) {
  return fetch({
    url:'api/customer_request',
    method:'post',
    data:data
  })
}
//首页底部用户申请客服回访接 区域列表
export function indexAreaList(data) {
  return fetch({
    url:'api/area/read',
    method:'get',
    params:{
      code:data
    }
  })
}
//首页 精选
export function indexBuildHouse(data) {
  return fetch({
    url:'api/selected',
    method:'get',
    params:{
      type:data
    }
  })
}
/**
 * 搜索页面
 *
 * **/
//搜索类型
export function searchClassic(data) {
  return fetch({
    url:'api/index/searchclassic',
    method:'get',
    params:data
  })
}
//搜索文章
export function searchArticle(data) {
  return fetch({
    url:'api/article/search',
    method:'get',
    params:{
      name:data.name,
      search:data.search
    }
  })
}
//搜索二手房
export function searchHouseList(data) {
  return fetch({
    url:'api/house/search',
    method:'get',
    params:{
      search:data
    }
  })
}

//搜索视频
export function searchVideoList(data) {
  return fetch({
    url:'api/video/search',
    method:'get',
    params:{
      name:data.name,
      search:data.search
    }
  })
}
//搜索楼盘
export function searchPremiseList(search,city_code) {
  return fetch({
    url:'api/premises/search',
    method:'get',
    params:{
      city_code:city_code,
      search:search
    }
  })
}
//热门搜索
export function searchHot(data) {
  return fetch({
    url:'api/search',
    method:'get',
    params:{
      type :data,
    }
  })
}

/**
 * 经纪人
 *
 * **/
//根据city_code 获取经纪人
export function agentList(page,data,na) {
  return fetch({
    url:'api/adviser',
    method:'get',
    params:{
      page:page,
      area_code:data,
      na:na
    }
  })
}
//根据关键词查询楼盘
export function premiseLike(data) {
  return fetch({
    url:'api/premises/like',
    method:'get',
    params:{
      search:data
    }
  })
}
//根据楼盘查找经纪人
export function premiseAgent(data) {
  return fetch({
    url:'api/premises/adviser',
    method:'get',
    params:{
      name:data
    }
  })
}
//经纪人主页
export function adviserWebsite(data,page) {
  return fetch({
    url:'api/adviser/' + data,
    method:'get',
    params:{
      page:page
    }
  })
}

/**
 *
 * 预约看房
 *
 */
//预约看房单个房源
export function lookHouse(data) {
  return fetch({
    url:'api/house/single',
    method:'get',
    params:{
      id:data
    }
  })
}
//预约看房单个口楼盘
export function lookBuild(data) {
  return fetch({
    url:'api/premises/single',
    method:'get',
    params:{
      id:data
    }
  })
}

//表单上传
export function reserveHouse(data) {
  return fetch({
    url:'api/reserve',
    method:'post',
    data:data
  })
}

//根据城市名查询城市数据
export function getCityMap(data) {
  return fetch({
    url:'api/city/match',
    method:'get',
    params:{
      name:data
    }
  })
}

//分享朋友圈
export function getWeChatUrl(data) {
  return fetch({
    url:'api/wechat',
    method:'get',
    params:{
      url:data
    }
  })
}


















//获取相关资讯
// export function getAboutRecommend(data) {
//   return fetch({
//     url:'appdata/Information/getListChildren',
//     method:'get',
//     params:data
//   })
// }
// 搜索区域
// export function getSearchRes(data) {
//   return fetch({
//     url:'appdata/Information/index',
//     method:'get',
//     params:data
//   })
// }

//获取底部菜单栏
export function MenuData(data) {
  return fetch({
    url:'appdata/Footmenu/getList',
    method:'get',
    params:data
  })
}

//测试
export function TestError(data) {
  return fetch({
    url:'appdata/Information/index',
    method:'get',
    params:data
  })

}
export function TestTwo(data) {
  return fetch({
    url:'index/test/returnErr404',
    method:'get',
    params:data
  })
}
export function TestThree(data) {
  return fetch({
    url:'index/test/returnErr500',
    method:'get',
    params:data
  })
}


// export function ApiName(data) {
//   return fetch({
//     url: 'login',
//     method: 'get',
//     params:data
//   })
// }
